package me.itsoo.artemis.framework.core.collect;

import lombok.Getter;

import java.io.Serializable;

/**
 * Kv
 *
 * @author zxy
 * @version 0.0.1
 * @since 2023/5/1
 */
@Getter
public class Kv<K, V> implements Serializable {

    private static final long serialVersionUID = 6841650632026023332L;

    private final K key;

    private final V value;

    private Kv<K, V> next;

    private Kv() {
        this(null, null);
    }

    public Kv(K key, V value) {
        this.key = key;
        this.value = value;
    }

    public static <K, V> Kv<K, V> empty() {
        return new Kv<>();
    }

    public void setNext(Kv<K, V> next) {
        this.next = next;
    }

    @Override
    public String toString() {
        return "{key=" + this.key + ", value=" + this.value + '}';
    }
}
